/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cp2004_assignment1;

import java.util.ArrayList;

/**
 *
 * @author zhaoyingxi
 */
public class ItemArr extends ArrayList<Item> {

    public ItemArr() {//The Inventory List:
        //Display a list of inventory
        Item z1 = new Item();
        z1.setName("Board   ");
        z1.setDescribe("Board is also very improtant.   ");
        z1.setNum(27);
        add(z1);

        Item z2 = new Item();
        z2.setName("CPU   ");
        z2.setDescribe("CPU is center of computer,it's very important.   ");
        z2.setNum(72);
        add(z2);

        Item z3 = new Item();
        z3.setName("mouse   ");
        z3.setDescribe("Mouse is a piont machine.Very Useful.   ");
        z3.setNum(61);
        add(z3);

        Item z4 = new Item();
        z4.setName("NIC   ");
        z4.setDescribe("Network Interface Card on the board.   ");
        z4.setNum(66);
        add(z4);

        Item z5 = new Item();
        z5.setName("Keyboard   ");
        z5.setDescribe("Iuput any string words.   ");
        z5.setNum(57);
        add(z5);

        Item z6 = new Item();
        z6.setName("Indicate light  ");
        z6.setDescribe("Instructed the computer's hard drive and power supply status of work.   ");
        z6.setNum(58);
        add(z6);
    }

    @Override
    public String toString() {  //toString() function

        String res = "";


        for (int i = 0; i < size(); i++) {
            Item p = get(i);
            res = res + p + "\n";
        }
        return res;
    }
}
